<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
    <title>车位信息管理</title>
    <meta name="decorator" content="ani-layui"/>
    <script type="text/javascript">

        $(document).ready(function () {
            jp.ajaxForm("#inputForm", function (data) {
                if (data.success) {
                    jp.success(data.msg);
                    jp.go("${ctx}/ipmp/carinfo/ipmpCarinfo");
                } else {
                    jp.error(data.msg);
                    $("#inputForm").find("button:submit").button("reset");
                }
            });

            $('#parkstarttime').datetimepicker({
                format: "YYYY-MM-DD HH:mm:ss"
            });
            $('#parkendtime').datetimepicker({
                format: "YYYY-MM-DD HH:mm:ss"
            });
        });
        function getBuildinginfo(){
            jp.get("${ctx}/ipmp/carinfo/ipmpCarinfo/getBuildinginfo?id="+$('#village\\.id option:selected') .val(), function(data){
                if(data.success){
                    if(data.body.mapdata!=null){
                        $('#build\\.id').empty();
                        for(var i=0;i<data.body.mapdata.length;i++){
                            $("#build\\.id").append("<option value='"+data.body.mapdata[i].value+"'>"+data.body.mapdata[i].label+"</option>");

                        }
                    }
                }else{
                    jp.error(data.msg);
                }
            })
        }
    </script>
</head>
<body>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <a class="panelButton" href="${ctx}/ipmp/carinfo/ipmpCarinfo"><i class="ti-angle-left"></i>
                            返回</a>
                    </h3>
                </div>
                <div class="panel-body">
                    <form:form id="inputForm" modelAttribute="ipmpCarinfo" action="${ctx}/ipmp/carinfo/ipmpCarinfo/save"
                               method="post" class="form-horizontal">
                        <form:hidden path="id"/>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">备注信息：</label>
                            <div class="col-sm-10">
                                <form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><font color="red">*</font>小区名称：</label>
                            <div class="col-sm-10">
                                <form:select path="village.id" class="form-control required" onchange="getBuildinginfo()">
                                    <form:option value="" label=""/>
                                    <form:options items="${dvlist}" itemLabel="label" itemValue="value"
                                                  htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><font color="red">*</font>楼宇名称：</label>
                            <div class="col-sm-10">
                                <form:select path="build.id" class="form-control required"  >
                                    <form:option value="${ipmpCarinfo.build.id}" label="${ipmpCarinfo.build.buildingname}"/>

                                </form:select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><font color="red">*</font>业主名称：</label>
                            <div class="col-sm-10">
                                <sys:userselect id="houseowner" name="houseowner.id"
                                                value="${ipmpCarinfo.houseowner.id}" labelName="houseowner.name"
                                                labelValue="${ipmpCarinfo.houseowner.name}"
                                                cssClass="form-control required"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><font color="red">*</font>汽车类型：</label>
                            <div class="col-sm-10">
                                <form:select path="cartype" class="form-control required"  >
                                    <form:option value="" label=""/>
                                    <form:options items="${fns:getDictList('car_type')}" itemLabel="label"
                                                  itemValue="value" htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" ><font color="red">*</font>停车类型：</label>
                            <div class="col-sm-10">
                                <form:select path="carparktype" class="form-control required" >
                                    <form:option value="" label=""/>
                                    <form:options items="${fns:getDictList('car_park_type')}" itemLabel="label"
                                                  itemValue="value" htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">停车时间起：</label>
                            <div class="col-sm-10">
                                <div class='input-group form_datetime' id='parkstarttime'>
                                    <input type='text' name="parkstarttime" class="form-control "
                                           value="<fmt:formatDate value="${ipmpCarinfo.parkstarttime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
                                    <span class="input-group-addon">
								<span class="glyphicon glyphicon-calendar"></span>
							</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">停车时间止：</label>
                            <div class="col-sm-10">
                                <div class='input-group form_datetime' id='parkendtime'>
                                    <input type='text' name="parkendtime" class="form-control "
                                           value="<fmt:formatDate value="${ipmpCarinfo.parkendtime}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
                                    <span class="input-group-addon">
								<span class="glyphicon glyphicon-calendar"></span>
							</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label "><font color="red">*</font>车牌号：</label>
                            <div class="col-sm-10">
                                <form:input path="Carno" htmlEscape="false" class="layui-input"/>
                            </div>
                        </div>

                        <c:if test="${mode == 'add' || mode=='edit'}">
                            <div class="col-lg-3"></div>
                            <div class="col-lg-6">
                                <div class="form-group text-center">
                                    <div>
                                        <button  class="btn btn-primary btn-block btn-lg btn-parsley"
                                                data-loading-text="正在提交...">提 交
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </c:if>
                    </form:form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>